package com.chaos.framework.starter.config.feign;


import jakarta.servlet.Filter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class OpenFeignFilterConfig {


    @Bean
    public FilterRegistrationBean TraceIdRequestFilter() {
        FilterRegistrationBean<Filter> filterFilterRegistrationBean = new FilterRegistrationBean<>();
        filterFilterRegistrationBean.setFilter(new OpenFeignMdcFilter());
        filterFilterRegistrationBean.setOrder(Integer.MAX_VALUE - 200);
        filterFilterRegistrationBean.addUrlPatterns("/*");
        return filterFilterRegistrationBean;
    }


}
